package cn.net.xyan.text.listener

import org.jnativehook.mouse.NativeMouseAdapter
import org.jnativehook.mouse.NativeMouseEvent
import java.awt.event.KeyEvent

class MouseListener: NativeMouseAdapter() {

    val job1 = SendKeyJob(intArrayOf(KeyEvent.VK_1))
    val job2 = SendKeyJob(intArrayOf(KeyEvent.VK_2))
    override fun nativeMouseReleased(e: NativeMouseEvent?) {
        //println(e!!.paramString())
    }

    override fun nativeMousePressed(e: NativeMouseEvent?) {
        //println(e!!.modifiers)
       // println(e!!.paramString())
        if (e!!.modifiers == 40960) {
            if (e.button == 5) {
                job2.started = false
                job1.started = !job1.started
            } else if (e.button == 4) {
                job1.started = false
                job2.started = !job2.started
            }
        }
    }

    override fun nativeMouseClicked(e: NativeMouseEvent?) {
        //println(e!!.paramString())
    }
}